SYSTEM
Section: MINTLIB LIBRARY FUNCTIONS
(3)
Updated: 3 March 1993
Index
Return to Main Contents
NAME
system - execute a command, passed a string
SYNOPSIS
#include <unistd.h>
int system(const char *cmd);
DESCRIPTION
system executes the command in the string, and waits
until it terminates.
The first word in the string is the name of the program
to be executed; this program is searched in the current
directory and on the directories set in the environment
variable PATH. The normal extensions ".ttp", ".tos" and
".prg" are tried when the program is being searched.
If the rest of the string contains unquoted '<' or '>'
characters, standard input or standard output for the
command to be run is redirected to the file with the
filename following the '<' or '>'.
The remaining part of the string is passed to the program
as a command line.
This routine is implemented using spawnvp.
RETURN VALUES
system(NULL) returns 1 as an indication system is supported.
When a valid command line is passed, system returns:
-1 when out of memory.
2 when the redirection of stdin or stdout fails.
The return value of the program called when successful.
SEE ALSO
spawnvp(3),
execve(3),
popen(3)
NOTE
On UN*X systems, this starts up the shell /bin/sh as a child
process. The shell executes the command passed to system.
Thus, on UN*X systems, one can pass a more complicated command
line to system, for instance one containing pipes or shell
scripts. This may cause some problems when porting UN*X
programs to the Atari.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUES
-
- SEE ALSO
-
- NOTE
-
This document was created by
man2html,
using the manual pages.
Time: 11:15:13 GMT, June 22, 2025